package us.nchu.tomtiger.rowMapper;

import org.springframework.jdbc.core.RowMapper;
import us.nchu.tomtiger.model.User;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by XiongXuan on 2018/1/8.
 */
public class UserRowMapper implements RowMapper<User> {

    @Override
    public User mapRow(ResultSet resultSet, int i) throws SQLException {
        User user = new User();

        user.setStatus(resultSet.getInt("status"));
        user.setPhoneNumber(resultSet.getString("phone_number"));
        user.setPassword(resultSet.getString("pass_word"));
        user.setNickName(resultSet.getString("nick_name"));
        user.setUserType(resultSet.getInt("user_type"));
        user.setSchoolName(resultSet.getString("school_name"));
        user.setMajor(resultSet.getString("major"));
        user.setContactType(resultSet.getInt("contact_type"));
        user.setContact(resultSet.getString("contact"));
        user.setIntro(resultSet.getString("intro"));
        user.setCertificate(resultSet.getString("certificate"));
        user.setStudentId(resultSet.getString("student_id"));

        return user;
    }
}
